<template>
    <van-nav-bar title="" left-text="返回" left-arrow @click-left="onClickLeft" />
    <div>
        <iframe width="100%" style="height: 100vh;border:none;" :src="pdfSrc"></iframe>
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
const route = useRoute()
const router = useRouter()

const pdfSrc = ref('')

const url = route?.query?.url
onMounted(() => {
    // console.log('pdfurl', this.pdfurl)
    // 此处，我是把文件夹放到public中，pdf文件夹就在打包完的根目录下，pdf/web/viewer.html
    pdfSrc.value = `http://api.accrlab.com/pdf/web/viewer.html?file=${encodeURIComponent(url)}`
    console.log('pdfSrc', pdfSrc)
})

function onClickLeft(){
    router.back()
}

</script>

<style>
#app {
	padding: 0 !important;
}

body {
	display: block !important;
    place-content: none !important;
    place-items: none !important;
}
</style>
